<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="../css/base.css" rel="stylesheet" type="text/css">
    <link href="../css/style.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="../js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="../js/paramsTool.js"></script>
    <script src="../js/layer.js"></script>
    <title>申请提现</title>
</head>
<style type="text/css">
    .swiper-container {width: 100%; height: 100%; margin: 0 auto;  position: relative;  overflow: hidden;  z-index: 1; }

    .swiper-container ul li {
        width: 29%;
        float: left;
        border: 1px solid #dcdcdc;
        margin:20px 0 0px 10px;
        text-align: center;
        height: 50px;
        padding: 18px 0;
        color: #888888;
        font-size: 18px;
    }

    .swiper-container ul li span {
        font-size: 19px;
        color: #444;
        font-weight: 500;
    }

    .phtact {
        background-color: #ea4821;
        color: #fff !important;
    }
    .phtact span{
        color: yellow !important;
    }

    .btnClass{
        margin: 20px auto;
        width: 95%;
        height: 50px;
        line-height: 50px;
        text-align: center;
        background-color: #ea4821;
        font-size: 20px;
        color: #FFF;
        border-radius: 5px;
    }
</style>
<script type="text/javascript">
    var host = window.location.origin;
    var postid= 12;
    var openid =  getCookie('wxopenid');
    var sid = getCookie('sid');
    var coin = getCookie('coin');

    if(!openid || !coin){
        getWxCode();
    }
    $(function(){

        $("#recharge li").click(function() {

            $(this).siblings('li').removeClass('phtact');  // 删除其他兄弟元素的样式

            $(this).addClass('phtact');                    // 添加当前元素的样式

            postid= $(".phtact").data('postid');
        });

        $(".btnClass").click(function(){
            openid =  getCookie('wxopenid');
            coin = getCookie('coin');
            sid = getCookie('sid');
            if(coin < postid){
                alert('您当前欢乐币不足哦,先去转盘试试手气吧!');
                return;
            }
            $.ajax({
                url: host+ "/transfers",        //sendPacket
                type: "get",
                dataType:'json',
                async:true,//请求是否异步，默认为异步，这也是ajax重要特性
                headers: {"content-type":"application/json","openid":openid,"sid":sid,"postcoin":postid},
                success:function(data){
                    if(data.code){
                        layer.open({
                            content: data.info
                            ,skin: 'msg'
                            ,time: 1.5 //2秒后自动关闭
                        });
                    }else {
                        layer.open({
                            content: '已成功发放至您的零钱包,不信可以去查看哦!'
                            ,btn: ['朕知道了']
                            ,yes: function(index){
                                layer.close(index);
                            }
                        });
                    }
                    setCookie('coin',FloatAdd(coin,-postid));
                },
                error:function() {
                    layer.open({
                        content: '兑换失败,请重试!'
                        ,skin: 'msg'
                        ,time: 1.5 //2秒后自动关闭
                    });
                }
            });
        });

    });


</script>
<body>
<div class="swiper-container">

    <ul id="recharge">
        <li data-postid="11" class="phtact">
            <span>10元</span><br>100金币
        </li>
        <li data-postid="20">
            <span>20元</span><br>200金币
        </li>
        <li data-postid="101">
            <span>30元</span><br>300金币
        </li>
    </ul>
</div>

<div class="btnClass">申请兑换</div>

<!--底部导航--
<div class="spring_bar">
    <a href="minWheel.html">
        <dl class="list">
            <dt class=""><img src="../image/ctb1on.png" /></dt>
            <dd>幸运转盘</dd>
        </dl>
    </a>
    <a href="shareCode.html">
        <dl class="list">
            <dt><img src="../image/ctb2.png" /></dt>
            <dd>推广二维码</dd>
        </dl>
    </a><a href="postCash.html">
    <dl class="list">
        <dt><img src="../image/ctbm.png" /></dt>
        <dd></dd>
    </dl>
</a><a href="recharge.html">
    <dl class="list">
        <dt>
            <img src="../image/ctb3.png" />
        </dt>
        <dd>
            充值中心
        </dd>
    </dl> </a>
    <a href="me.html">
        <dl class="list">
            <dt><img src="../image/ctb4.png" /></dt>
            <dd>个人中心</dd>
        </dl>
    </a>
</div>
<!--底部导航end-->

</body>
</html>